<!DOCTYPE html>
<html lang="en">

<head>
    <title>Ch05-02 Alarm Alert with else</title>
</head>

<body onload="doCheckAlarm()">
    <script>
        function doCheckAlarm() {
            var currentDate = new Date();
            var hours = currentDate.getHours();
            var mins = currentDate.getMinutes();
            
            var itIsTimeToGetUp = (hours>7) || (hours==7 && minutes>29); 
            
            if(itIsTimeToGetUp) 
                alert("It is time to get up!");
            else
                alert("You can stay in bed");
        }
    </script>
</body>

</html>